
package anZhuo.MoMing.MoZhangAiCaoZuo;

import java.lang.ref.WeakReference;

public class rg_MoZhangAiFuZhuLei {

    public rg_MoZhangAiFuZhuLei ()  { }

    private static java.lang.ref.WeakReference<android.accessibilityservice.AccessibilityService> serviceWeakReference;
    private static java.util.List<android.view.accessibility.AccessibilityNodeInfo>allNodes = new java.util.ArrayList<android.view.accessibility.AccessibilityNodeInfo>();
    private static void refreshAllNode(android.view.accessibility.AccessibilityNodeInfo parent){
        if (serviceWeakReference != null && serviceWeakReference.get() != null){
            allNodes.clear();
            getAllNodes(parent == null ? serviceWeakReference.get().getRootInActiveWindow() : parent);
        }
    }
    private static void getAllNodes(android.view.accessibility.AccessibilityNodeInfo parent){
        if (parent == null) return;
        allNodes.add(parent);
        if (parent.getChildCount() > 0){
            for (int i = 0; i < parent.getChildCount(); i++){
                if (parent.getChild(i) != null && parent.getChild(i).getChildCount() > 0){
                    getAllNodes(parent.getChild(i));
                }else{
                    allNodes.add(parent.getChild(i));
                }
            }
        }
    }

    public static synchronized void rg_ChuShiHua39 (android.accessibilityservice.AccessibilityService rg_FuWuDuiXiang2) {
        if (serviceWeakReference == null && rg_FuWuDuiXiang2 != null){
            serviceWeakReference = new WeakReference<android.accessibilityservice.AccessibilityService>(rg_FuWuDuiXiang2);
        }
    }

    public static boolean rg_ChanJiZuoBiao (int rg_HengZuoBiao38, int rg_ZongZuoBiao38) {
        if (android.os.Build.VERSION.SDK_INT >= 24)
        {
            android.accessibilityservice.GestureDescription.Builder rg_ShouShiGouJian = new android.accessibilityservice.GestureDescription.Builder ();
            android.graphics.Path rg_LuJing46 = new android.graphics.Path ();
            rg_LuJing46.moveTo ((float)rg_HengZuoBiao38, (float)rg_ZongZuoBiao38);
            android.accessibilityservice.GestureDescription.StrokeDescription rg_BiHua;
            rg_BiHua = new android.accessibilityservice.GestureDescription.StrokeDescription(rg_LuJing46, 0, 50);
            rg_ShouShiGouJian.addStroke(rg_BiHua);
            if (serviceWeakReference != null && serviceWeakReference.get() != null){
                return serviceWeakReference.get().dispatchGesture(rg_ShouShiGouJian.build(), null, null);
            }
        }
        return (anZhuo.MoMing.ZaQiZaBa.rg_RootGongJuLei.rg_Root_ZhiHangMingLing ("input tap " + String.valueOf (rg_HengZuoBiao38) + " " + String.valueOf (rg_ZongZuoBiao38)) == 0);
    }

    public static android.view.accessibility.AccessibilityNodeInfo rg_ZhiDingZiNeiRongMiaoShuChaZhaoJieDian (String rg_MiaoShuNeiRong3, android.view.accessibility.AccessibilityNodeInfo rg_ZhiDingFuJieDian5) {
        if (serviceWeakReference != null && serviceWeakReference.get() != null){
            refreshAllNode(rg_ZhiDingFuJieDian5);
            if (allNodes.isEmpty()) return null;
            for (android.view.accessibility.AccessibilityNodeInfo temp : allNodes){
                if (temp != null && temp.getContentDescription() != null && temp.getContentDescription().toString().contains(rg_MiaoShuNeiRong3)){
                    return temp;
                }
            }
        }
        return null;
    }

    public static java.util.List<android.view.accessibility.AccessibilityNodeInfo> rg_ZhiDingIDChaZhaoJieDianLieBiao (String rg_IDZiYuan2, android.view.accessibility.AccessibilityNodeInfo rg_ZhiDingFuJieDian6) {
        if (serviceWeakReference != null && serviceWeakReference.get() != null){
            android.view.accessibility.AccessibilityNodeInfo rootNode = serviceWeakReference.get().getRootInActiveWindow();
            if (rootNode == null) return null;
            java.util.List<android.view.accessibility.AccessibilityNodeInfo> nodeInfoList = rg_ZhiDingFuJieDian6 == null ? rootNode.findAccessibilityNodeInfosByViewId(rg_IDZiYuan2) : rg_ZhiDingFuJieDian6.findAccessibilityNodeInfosByViewId(rg_IDZiYuan2);
            if (nodeInfoList != null && !nodeInfoList.isEmpty()) {
                return nodeInfoList;
            }
        }
        return null;
    }

    public static java.util.List<android.view.accessibility.AccessibilityNodeInfo> rg_ZhiDingZiNeiRongMiaoShuChaZhaoJieDianLieBiao (String rg_MiaoShuNeiRong5, android.view.accessibility.AccessibilityNodeInfo rg_ZhiDingFuJieDian11) {
        if (serviceWeakReference != null && serviceWeakReference.get() != null){
            refreshAllNode(rg_ZhiDingFuJieDian11);
            if (allNodes.isEmpty()) return null;
            java.util.List<android.view.accessibility.AccessibilityNodeInfo>nodeList = new java.util.ArrayList<android.view.accessibility.AccessibilityNodeInfo>();
            for (android.view.accessibility.AccessibilityNodeInfo temp : allNodes){
                if (temp != null && temp.getContentDescription() != null && temp.getContentDescription().toString().contains(rg_MiaoShuNeiRong5)){
                    nodeList.add(temp);
                }
            }
            return nodeList;
        }
        return null;
    }
}
